package own.stu.jobgib.playown.fsm.hfsm.states;

import lombok.extern.slf4j.Slf4j;
import own.stu.jobgib.playown.fsm.hfsm.StateBase;
import own.stu.jobgib.playown.fsm.hfsm.StateEnum;

@Slf4j
public class StateEat extends StateBase {

    boolean iFull = false;

    public StateEat() {
        super(StateEnum.EAT);
    }

    @Override
    public void onEnter() {
        log.info("开始吃饭啦");
    }

    @Override
    public void onExecute() {
        log.info("吃饭中");
        iFull = true;
        // 如果吃饱了，转换到休息状态
        if (iFull) {
            transitionEvent(StateEnum.RESET);
        }
    }

    @Override
    public void onExit() {
        log.info("吃的好饱啊，不吃了");
        log.info("刷碗、刷锅");
        log.info("擦桌子");
        log.info("打扫厨房");
    }
}
